* 07 MAY 2008
* REPLICATION FILE FOR "FINANCING THE PEACE: EVALUATING WORLD BANK POST-CONFLICT ASSISTANCE PROGRAMS"
* by Thomas E. Flores and Irfan Nooruddin

**** INSTRUMENT

** FIRST STAGE

reg wb_commit_total_percap s3uni3 ally_france_defense /*
*/ if west==0&recover_time2~=., cluster(ctrycode)
test s3uni3 ally_france_defense

reg wb_commit_total_percap s3uni3 ally_france_defense/*
*/ t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&recover_time2~=., cluster(ctrycode)
test s3uni3 ally_france_defense
predict instrument_wb
gen instrument_wb_lag = l.instrument_wb

** CHECK IF EXCLUSION RESTRICTION IS GOOD

stset recover_time2, f(recover2==1) exit(exit_year2==1) id(fnid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_percap_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 s3uni3 ally_france_defense /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)
test s3uni3 ally_france_defense

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ instrument_wb_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 s3uni3 ally_france_defense /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)
test s3uni3 ally_france_defense

stset recover_time2, f(recur2==1) exit(exit_year2==1) id(fnid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_percap_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 s3uni3 ally_france_defense /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)
test s3uni3 ally_france_defense

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ instrument_wb_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 s3uni3 ally_france_defense /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)
test s3uni3 ally_france_defense

**** MAIN MODELS FOR TABLES 1 AND 2 AND 3

** ECONOMIC RECOVERY

stset recover_time2, f(recover2==1) exit(exit_year2==1) id(fnid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_percap_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)


streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ instrument_wb_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2  /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

tsset id year
bootstrap _b, reps(2000) cluster(id) idcluster(newid) group(id) bca: /*
*/ streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ instrument_wb_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

** CONFLICT RECURRENCE

stset recover_time2, f(recur2==1) exit(exit_year2==1) id(fnid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_percap_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 s3uni3 ally_france_defense /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ instrument_wb_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 ally_france_defense /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

tsset id year
bootstrap _b, reps(2000) cluster(id) idcluster(newid) group(id) bca: /*
*/ streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ instrument_wb_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

**************************************************************

**** ROBUSTNESS CHECKS FOR ONLINE APPENDIX

** ROBUST TO USING COX MODELS INSTEAD

* RECOVERY

stset recover_time2, f(recover2==1) exit(exit_year2==1) id(fnid)

stcox t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_percap_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", cluster(ctryid)

bootstrap _b, reps(2000) cluster(id) idcluster(newid) group(id) bca: /*
*/ stcox t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ instrument_wb_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", cluster(ctryid)

estat bootstrap, all

* RECURRENCE

stset recover_time2, f(recur2==1) exit(exit_year2==1) id(fnid)

stcox t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_percap_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", cluster(ctryid)

bootstrap _b, reps(2000) cluster(id) idcluster(newid) group(id) bca: /*
*/ stcox t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ instrument_wb_lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", cluster(ctryid)

estat bootstrap, all

*****************************************************************
*** ROBUST TO ALTERNATIVE MEASURES OF WB: TOTAL COMMITMENT 
set more off
** USING BOTH INSTRUMENTS SIMULTANEOUSLY

/*
reg wb_commit_total ally_france_defense s3uni3 if recover_time2~=., cluster(ctryid)
test ally_france_defense s3uni3
predict wb_commit_total_pre3
gen wb_commit_total_pre3lag = l.wb_commit_total_pre3
*/

* RECOVERY

stset recover_time2, f(recover2==1) exit(exit_year2==1) id(fnid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_pre3lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

bootstrap _b, reps(2000) cluster(id) idcluster(newid) group(id) bca: /*
*/ streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_pre3lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

estat bootstrap, all

* RECURRENCE

stset recover_time2, f(recur2==1) exit(exit_year2==1) id(fnid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_pre3lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

bootstrap _b, reps(2000) cluster(id) idcluster(newid) group(id) bca: /*
*/ streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ wb_commit_total_pre3lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

estat bootstrap, all

*****************************************************************
*** ROBUST TO ALTERNATIVE MEASURES OF WB: TOTAL COMMITMENT (LOG)

** USING BOTH INSTRUMENTS SIMULTANEOUSLY

/*
reg lnwb_commit_total ally_france_defense s3uni3 if recover_time2~=., cluster(ctryid)
test ally_france_defense s3uni3
predict lnwb_commit_total_pre3
gen lnwb_commit_total_pre3lag = l.lnwb_commit_total_pre3
*/

* RECOVERY

stset recover_time2, f(recover2==1) exit(exit_year2==1) id(fnid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ lnwb_commit_total /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ lnwb_commit_total_pre3lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

bootstrap _b, reps(2000) cluster(id) idcluster(newid) group(id) bca: /*
*/ streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ lnwb_commit_total_pre3lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

estat bootstrap, all

* RECURRENCE

stset recover_time2, f(recur2==1) exit(exit_year2==1) id(fnid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ lnwb_commit_total /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ lnwb_commit_total_pre3lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

bootstrap _b, reps(2000) cluster(id) idcluster(newid) group(id) bca: /*
*/ streg t2_auto t2_demo /*
*/ prewar_lngdppc2 /*
*/ lnwb_commit_total_pre3lag /*
*/ issue_territory_lag cw_duration_lag cw_duration_sq aidpcXtimecat1 aidpcXtimecat2 aidpcXtimecat3 /*
*/ damage victory_lag peace_agreement_lag cim_cim recovery_num2 /*
*/ if west==0&ctrycode~="GHA", dist(lnormal) cluster(ctryid)

estat bootstrap, all

save, replace
